/**
 * 自定义用户
 * */

var formList = [];


//列表
function getIndex(){
    var formData = {
        start: pages.start,
        limit: pages.limit
    };
    $.ajax({
        type: apis.userIndex.method,
        url: apis.userIndex.url,
        data: formData,
        success: function (res) {
            console.log(res);
            if (res.code < 0) {
                msgPop({msg: res.msg});
                return
            }
            formList = res.data;
            $('#pageTotal').html(res.total);
            indexHtml();
            var pageObj = pages; pageObj.total = res.total;
            pageHtml(pageObj);
        },
        error: function () {
            console.log('错误啦');
        }
    });
}
//列表字符串
function indexHtml(){
    if (formList.length == 0) {
        msgPop({msg: '没有数据'}); return
    }
    var d = formList;
    var h = '', i;
    for (i = 0; i < d.length; i ++) {
        h += '<tr class="text-c">';
        h += '<td>' + d[i].id + '</td>';
        h += '<td>' + d[i].uname + '</td>';
        h += '<td>' + d[i].cname + '</td>';
        h += '<td>' + d[i].uptime + '</td>';
        h += '<td>' + d[i].addtime + '</td>';
        h += '</td>';
        h += '</tr>';
    }
    $('tbody').html(h);
}